<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FFmpegKit iOS / macOS / tvOS API: fftools_ffmpeg_mux.c Source File</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="../../ffmpeg-kit-icon-v9-small.png"/></td>
  <td id="projectalign">
   <div id="projectname">FFmpegKit iOS / macOS / tvOS API<span id="projectnumber">&#160;5.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">fftools_ffmpeg_mux.c</div></div>
</div><!--header-->
<div class="contents">
<a href="../../d5/d94/fftools__ffmpeg__mux_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="comment">/*</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span><span class="comment"> * This file is part of FFmpeg.</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span><span class="comment"> * copyright (c) 2022 Taner Sener ( tanersener gmail com )</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span><span class="comment"> *</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="comment"> * FFmpeg is free software; you can redistribute it and/or</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span><span class="comment"> * modify it under the terms of the GNU Lesser General Public</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span><span class="comment"> * License as published by the Free Software Foundation; either</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="comment"> * version 2.1 of the License, or (at your option) any later version.</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span><span class="comment"> *</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="comment"> * FFmpeg is distributed in the hope that it will be useful,</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span><span class="comment"> * Lesser General Public License for more details.</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span><span class="comment"> *</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span><span class="comment"> * You should have received a copy of the GNU Lesser General Public</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno">   16</span><span class="comment"> * License along with FFmpeg; if not, write to the Free Software</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span><span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span><span class="comment"> */</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span> </div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span><span class="comment">/*</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="comment"> * This file is the modified version of ffmpeg_mux.c file living in ffmpeg source code under the fftools folder. We</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="comment"> * manually update it each time we depend on a new ffmpeg version. Below you can see the list of changes applied</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="comment"> * by us to develop the ffmpeg-kit library.</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="comment"> *</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span><span class="comment"> * ffmpeg-kit changes by Taner Sener</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span><span class="comment"> *</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno">   27</span><span class="comment"> * 09.2022</span></div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span><span class="comment"> * --------------------------------------------------------</span></div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno">   29</span><span class="comment"> * - fftools_ prefix added to fftools headers</span></div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span><span class="comment"> * - using main_ffmpeg_return_code instead of main_return_code</span></div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span><span class="comment"> * - printf replaced with av_log statements</span></div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span><span class="comment"> */</span></div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span> </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span><span class="preprocessor">#include &lt;stdio.h&gt;</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span><span class="preprocessor">#include &lt;string.h&gt;</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span><span class="preprocessor">#include &quot;<a class="code" href="../../d7/db3/fftools__ffmpeg_8h.html">fftools_ffmpeg.h</a>&quot;</span></div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span> </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span><span class="preprocessor">#include &quot;libavutil/fifo.h&quot;</span></div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span><span class="preprocessor">#include &quot;libavutil/intreadwrite.h&quot;</span></div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span><span class="preprocessor">#include &quot;libavutil/log.h&quot;</span></div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span><span class="preprocessor">#include &quot;libavutil/mem.h&quot;</span></div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span><span class="preprocessor">#include &quot;libavutil/timestamp.h&quot;</span></div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span> </div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span><span class="preprocessor">#include &quot;libavcodec/packet.h&quot;</span></div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span><span class="preprocessor">#include &quot;libavformat/avformat.h&quot;</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span><span class="preprocessor">#include &quot;libavformat/avio.h&quot;</span></div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span> </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"><a class="line" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#ac237321f98a7041c9f6004d2ce8a425c">   50</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#ac237321f98a7041c9f6004d2ce8a425c">close_all_output_streams</a>(<a class="code hl_struct" href="../../db/dde/struct_output_stream.html">OutputStream</a> *ost, <a class="code hl_enumeration" href="../../d7/db3/fftools__ffmpeg_8h.html#a54e97364f74d8bf15062a8ea185f1c31">OSTFinished</a> this_stream, <a class="code hl_enumeration" href="../../d7/db3/fftools__ffmpeg_8h.html#a54e97364f74d8bf15062a8ea185f1c31">OSTFinished</a> others)</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span>{</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>    <span class="keywordtype">int</span> i;</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span>    <span class="keywordflow">for</span> (i = 0; i &lt; <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a2bd3657586bb29d6357ddc0ed3bda70b">nb_output_streams</a>; i++) {</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>        <a class="code hl_struct" href="../../db/dde/struct_output_stream.html">OutputStream</a> *ost2 = <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a205ff61315f3766dae7c5e1552de2ccf">output_streams</a>[i];</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span>        ost2-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a2cb215b02eb510c4b19947063a5d5bd8">finished</a> |= ost == ost2 ? this_stream : others;</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span>    }</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span>}</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="../../d7/db3/fftools__ffmpeg_8h.html#aea0554f44067721a9066e82c8f5fc847">   59</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#aea0554f44067721a9066e82c8f5fc847">of_write_packet</a>(<a class="code hl_struct" href="../../de/df2/struct_output_file.html">OutputFile</a> *of, AVPacket *pkt, <a class="code hl_struct" href="../../db/dde/struct_output_stream.html">OutputStream</a> *ost,</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span>                     <span class="keywordtype">int</span> unqueue)</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>{</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>    AVFormatContext *s = of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>;</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span>    AVStream *st = ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">st</a>;</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span>    <span class="keywordtype">int</span> ret;</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span> </div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span>    <span class="comment">/*</span></div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span><span class="comment">     * Audio encoders may split the packets --  #frames in != #packets out.</span></div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span><span class="comment">     * But there is no reordering, so we can limit the number of output packets</span></div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span><span class="comment">     * by simply dropping them here.</span></div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span><span class="comment">     * Counting encoded video frames needs to be done separately because of</span></div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span><span class="comment">     * reordering, see do_video_out().</span></div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span><span class="comment">     * Do not count the packet when unqueued because it has been counted when queued.</span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span><span class="comment">     */</span></div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span>    <span class="keywordflow">if</span> (!(st-&gt;codecpar-&gt;codec_type == AVMEDIA_TYPE_VIDEO &amp;&amp; ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#abd0357b7272cdb232e2db73eb458329e">encoding_needed</a>) &amp;&amp; !unqueue) {</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>        <span class="keywordflow">if</span> (ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a989065f82c418b8c06bef4b4689ae1d8">frame_number</a> &gt;= ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a6cb813f6df7342f0f37825241a3cd51b">max_frames</a>) {</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>            av_packet_unref(pkt);</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>            <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span>        }</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span>        ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a989065f82c418b8c06bef4b4689ae1d8">frame_number</a>++;</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span>    }</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span> </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>    <span class="keywordflow">if</span> (!of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a7f831b66ccff154c4e9d880d900e5b3f">header_written</a>) {</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span>        AVPacket *tmp_pkt;</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>        <span class="comment">/* the muxer is not initialized yet, buffer the packet */</span></div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>        <span class="keywordflow">if</span> (!av_fifo_can_write(ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ae200b98ec6443b72e48ee97265921bbc">muxing_queue</a>)) {</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span>            <span class="keywordtype">size_t</span> cur_size = av_fifo_can_read(ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ae200b98ec6443b72e48ee97265921bbc">muxing_queue</a>);</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span>            <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> are_we_over_size =</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno">   88</span>                (ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#af18a803d7d7db08a1cdac6b54fc1a58f">muxing_queue_data_size</a> + pkt-&gt;size) &gt; ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a6e2ea45e90d7df93766f580a39469719">muxing_queue_data_threshold</a>;</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno">   89</span>            <span class="keywordtype">size_t</span> limit    = are_we_over_size ? ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a006aed9d49962d931da10f19a135f2bb">max_muxing_queue_size</a> : SIZE_MAX;</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno">   90</span>            <span class="keywordtype">size_t</span> new_size = FFMIN(2 * cur_size, limit);</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span> </div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno">   92</span>            <span class="keywordflow">if</span> (new_size &lt;= cur_size) {</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span>                av_log(NULL, AV_LOG_ERROR,</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>                       <span class="stringliteral">&quot;Too many packets buffered for output stream %d:%d.\n&quot;</span>,</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span>                       ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#af608105788daa4300771669d992ef890">file_index</a>, ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">st</a>-&gt;index);</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span>                <a class="code hl_function" href="../../d7/dcc/fftools__cmdutils_8c.html#a00fcf983c7dd20dd65568b3ebc20ed44">exit_program</a>(1);</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span>            }</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>            ret = av_fifo_grow2(ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ae200b98ec6443b72e48ee97265921bbc">muxing_queue</a>, new_size - cur_size);</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span>            <span class="keywordflow">if</span> (ret &lt; 0)</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>                <a class="code hl_function" href="../../d7/dcc/fftools__cmdutils_8c.html#a00fcf983c7dd20dd65568b3ebc20ed44">exit_program</a>(1);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>        }</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span>        ret = av_packet_make_refcounted(pkt);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span>        <span class="keywordflow">if</span> (ret &lt; 0)</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span>            <a class="code hl_function" href="../../d7/dcc/fftools__cmdutils_8c.html#a00fcf983c7dd20dd65568b3ebc20ed44">exit_program</a>(1);</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno">  105</span>        tmp_pkt = av_packet_alloc();</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno">  106</span>        <span class="keywordflow">if</span> (!tmp_pkt)</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno">  107</span>            <a class="code hl_function" href="../../d7/dcc/fftools__cmdutils_8c.html#a00fcf983c7dd20dd65568b3ebc20ed44">exit_program</a>(1);</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span>        av_packet_move_ref(tmp_pkt, pkt);</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>        ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#af18a803d7d7db08a1cdac6b54fc1a58f">muxing_queue_data_size</a> += tmp_pkt-&gt;size;</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span>        av_fifo_write(ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ae200b98ec6443b72e48ee97265921bbc">muxing_queue</a>, &amp;tmp_pkt, 1);</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno">  111</span>        <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno">  112</span>    }</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno">  113</span> </div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno">  114</span>    <span class="keywordflow">if</span> ((st-&gt;codecpar-&gt;codec_type == AVMEDIA_TYPE_VIDEO &amp;&amp; ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a7efb75b87428b8442a2efd06734c9fb1">vsync_method</a> == <a class="code hl_enumvalue" href="../../d7/db3/fftools__ffmpeg_8h.html#aadd6ba914d1b3ecdf3b1322294beed34acf6f7467f9f3db143f3038b7ee906829">VSYNC_DROP</a>) ||</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno">  115</span>        (st-&gt;codecpar-&gt;codec_type == AVMEDIA_TYPE_AUDIO &amp;&amp; <a class="code hl_variable" href="../../d7/db3/fftools__ffmpeg_8h.html#a7ebbd72251d3d58fe5b316928a40bed3">audio_sync_method</a> &lt; 0))</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span>        pkt-&gt;pts = pkt-&gt;dts = AV_NOPTS_VALUE;</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno">  117</span> </div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno">  118</span>    <span class="keywordflow">if</span> (st-&gt;codecpar-&gt;codec_type == AVMEDIA_TYPE_VIDEO) {</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno">  119</span>        <span class="keywordflow">if</span> (ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ab13acc03a389653d882f221141f12ae3">frame_rate</a>.num &amp;&amp; ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a9cd48cbdf903d5bfee1b9c774e5cd46e">is_cfr</a>) {</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno">  120</span>            <span class="keywordflow">if</span> (pkt-&gt;duration &gt; 0)</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno">  121</span>                av_log(NULL, AV_LOG_WARNING, <span class="stringliteral">&quot;Overriding packet duration by frame rate, this should not happen\n&quot;</span>);</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span>            pkt-&gt;duration = av_rescale_q(1, av_inv_q(ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ab13acc03a389653d882f221141f12ae3">frame_rate</a>),</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span>                                         ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a253593d67e5088cf53c89aeb7e82cdc7">mux_timebase</a>);</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno">  124</span>        }</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno">  125</span>    }</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno">  126</span> </div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno">  127</span>    av_packet_rescale_ts(pkt, ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a253593d67e5088cf53c89aeb7e82cdc7">mux_timebase</a>, ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">st</a>-&gt;time_base);</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span> </div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno">  129</span>    <span class="keywordflow">if</span> (!(s-&gt;oformat-&gt;flags &amp; AVFMT_NOTIMESTAMPS)) {</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno">  130</span>        <span class="keywordflow">if</span> (pkt-&gt;dts != AV_NOPTS_VALUE &amp;&amp;</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno">  131</span>            pkt-&gt;pts != AV_NOPTS_VALUE &amp;&amp;</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno">  132</span>            pkt-&gt;dts &gt; pkt-&gt;pts) {</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span>            av_log(s, AV_LOG_WARNING, <span class="stringliteral">&quot;Invalid DTS: %&quot;</span>PRId64<span class="stringliteral">&quot; PTS: %&quot;</span>PRId64<span class="stringliteral">&quot; in output stream %d:%d, replacing by guess\n&quot;</span>,</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span>                   pkt-&gt;dts, pkt-&gt;pts,</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>                   ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#af608105788daa4300771669d992ef890">file_index</a>, ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">st</a>-&gt;index);</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>            pkt-&gt;pts =</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span>            pkt-&gt;dts = pkt-&gt;pts + pkt-&gt;dts + ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a1fd50164583dbdc664706be005120c1d">last_mux_dts</a> + 1</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span>                     - FFMIN3(pkt-&gt;pts, pkt-&gt;dts, ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a1fd50164583dbdc664706be005120c1d">last_mux_dts</a> + 1)</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno">  139</span>                     - FFMAX3(pkt-&gt;pts, pkt-&gt;dts, ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a1fd50164583dbdc664706be005120c1d">last_mux_dts</a> + 1);</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno">  140</span>        }</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno">  141</span>        <span class="keywordflow">if</span> ((st-&gt;codecpar-&gt;codec_type == AVMEDIA_TYPE_AUDIO || st-&gt;codecpar-&gt;codec_type == AVMEDIA_TYPE_VIDEO || st-&gt;codecpar-&gt;codec_type == AVMEDIA_TYPE_SUBTITLE) &amp;&amp;</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno">  142</span>            pkt-&gt;dts != AV_NOPTS_VALUE &amp;&amp;</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno">  143</span>            ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a1fd50164583dbdc664706be005120c1d">last_mux_dts</a> != AV_NOPTS_VALUE) {</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno">  144</span>            int64_t max = ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a1fd50164583dbdc664706be005120c1d">last_mux_dts</a> + !(s-&gt;oformat-&gt;flags &amp; AVFMT_TS_NONSTRICT);</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span>            <span class="keywordflow">if</span> (pkt-&gt;dts &lt; max) {</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span>                <span class="keywordtype">int</span> loglevel = max - pkt-&gt;dts &gt; 2 || st-&gt;codecpar-&gt;codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG;</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno">  147</span>                <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d7/db3/fftools__ffmpeg_8h.html#aa30902db873df385e004b04e2ecf7f6f">exit_on_error</a>)</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span>                    loglevel = AV_LOG_ERROR;</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno">  149</span>                av_log(s, loglevel, <span class="stringliteral">&quot;Non-monotonous DTS in output stream &quot;</span></div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno">  150</span>                       <span class="stringliteral">&quot;%d:%d; previous: %&quot;</span>PRId64<span class="stringliteral">&quot;, current: %&quot;</span>PRId64<span class="stringliteral">&quot;; &quot;</span>,</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno">  151</span>                       ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#af608105788daa4300771669d992ef890">file_index</a>, ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">st</a>-&gt;index, ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a1fd50164583dbdc664706be005120c1d">last_mux_dts</a>, pkt-&gt;dts);</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno">  152</span>                <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d7/db3/fftools__ffmpeg_8h.html#aa30902db873df385e004b04e2ecf7f6f">exit_on_error</a>) {</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno">  153</span>                    av_log(NULL, AV_LOG_FATAL, <span class="stringliteral">&quot;aborting.\n&quot;</span>);</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno">  154</span>                    <a class="code hl_function" href="../../d7/dcc/fftools__cmdutils_8c.html#a00fcf983c7dd20dd65568b3ebc20ed44">exit_program</a>(1);</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno">  155</span>                }</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno">  156</span>                av_log(s, loglevel, <span class="stringliteral">&quot;changing to %&quot;</span>PRId64<span class="stringliteral">&quot;. This may result &quot;</span></div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno">  157</span>                       <span class="stringliteral">&quot;in incorrect timestamps in the output file.\n&quot;</span>,</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno">  158</span>                       max);</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno">  159</span>                <span class="keywordflow">if</span> (pkt-&gt;pts &gt;= pkt-&gt;dts)</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno">  160</span>                    pkt-&gt;pts = FFMAX(pkt-&gt;pts, max);</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno">  161</span>                pkt-&gt;dts = max;</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno">  162</span>            }</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno">  163</span>        }</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno">  164</span>    }</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno">  165</span>    ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a1fd50164583dbdc664706be005120c1d">last_mux_dts</a> = pkt-&gt;dts;</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno">  166</span> </div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno">  167</span>    ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac0eae8884c54583e58eaa1999b342179">data_size</a> += pkt-&gt;size;</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno">  168</span>    ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a5a6eb3819ace72b542142a7082ceced3">packets_written</a>++;</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno">  169</span> </div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno">  170</span>    pkt-&gt;stream_index = ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ae22fe6ee1999d45be0d8722d04294a22">index</a>;</div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno">  171</span> </div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno">  172</span>    <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d7/db3/fftools__ffmpeg_8h.html#ae684cc527fec35feafac738f59a5fb34">debug_ts</a>) {</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno">  173</span>        av_log(NULL, AV_LOG_INFO, <span class="stringliteral">&quot;muxer &lt;- type:%s &quot;</span></div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno">  174</span>                <span class="stringliteral">&quot;pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s size:%d\n&quot;</span>,</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno">  175</span>                av_get_media_type_string(ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ab7b674f9a0c60e3e02526d560a83f583">enc_ctx</a>-&gt;codec_type),</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno">  176</span>                av_ts2str(pkt-&gt;pts), av_ts2timestr(pkt-&gt;pts, &amp;ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">st</a>-&gt;time_base),</div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno">  177</span>                av_ts2str(pkt-&gt;dts), av_ts2timestr(pkt-&gt;dts, &amp;ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">st</a>-&gt;time_base),</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno">  178</span>                av_ts2str(pkt-&gt;duration), av_ts2timestr(pkt-&gt;duration, &amp;ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">st</a>-&gt;time_base),</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno">  179</span>                pkt-&gt;size</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno">  180</span>              );</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno">  181</span>    }</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno">  182</span> </div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno">  183</span>    ret = av_interleaved_write_frame(s, pkt);</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno">  184</span>    <span class="keywordflow">if</span> (ret &lt; 0) {</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno">  185</span>        <a class="code hl_function" href="../../d7/dcc/fftools__cmdutils_8c.html#a2911387e778b01a25f0e65eabadf1b7b">print_error</a>(<span class="stringliteral">&quot;av_interleaved_write_frame()&quot;</span>, ret);</div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno">  186</span>        <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a9dfb20bc0a5b38e1f8a12d051c32c17f">main_ffmpeg_return_code</a> = 1;</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno">  187</span>        <a class="code hl_function" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#ac237321f98a7041c9f6004d2ce8a425c">close_all_output_streams</a>(ost, <a class="code hl_enumvalue" href="../../d7/db3/fftools__ffmpeg_8h.html#a54e97364f74d8bf15062a8ea185f1c31ae8b7f720076ace3e8c20648c8b77835b">MUXER_FINISHED</a> | <a class="code hl_enumvalue" href="../../d7/db3/fftools__ffmpeg_8h.html#a54e97364f74d8bf15062a8ea185f1c31acd6c6d4f0864009dfe2fb65c496f39a7">ENCODER_FINISHED</a>, <a class="code hl_enumvalue" href="../../d7/db3/fftools__ffmpeg_8h.html#a54e97364f74d8bf15062a8ea185f1c31acd6c6d4f0864009dfe2fb65c496f39a7">ENCODER_FINISHED</a>);</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno">  188</span>    }</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno">  189</span>}</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno">  190</span> </div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"><a class="line" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#ae7e4c98861cf63306a9211c4b056f757">  191</a></span><span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code hl_function" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#ae7e4c98861cf63306a9211c4b056f757">print_sdp</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno">  192</span>{</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno">  193</span>    <span class="keywordtype">char</span> sdp[16384];</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno">  194</span>    <span class="keywordtype">int</span> i;</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno">  195</span>    <span class="keywordtype">int</span> j, ret;</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno">  196</span>    AVIOContext *sdp_pb;</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno">  197</span>    AVFormatContext **avc;</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno">  198</span> </div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno">  199</span>    <span class="keywordflow">for</span> (i = 0; i &lt; <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a3d777831518f2c831790dd5cd6b96ddf">nb_output_files</a>; i++) {</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno">  200</span>        <span class="keywordflow">if</span> (!<a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a22c5e53407c3f14a8111e898dff42904">output_files</a>[i]-&gt;header_written)</div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno">  201</span>            <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno">  202</span>    }</div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno">  203</span> </div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno">  204</span>    avc = av_malloc_array(<a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a3d777831518f2c831790dd5cd6b96ddf">nb_output_files</a>, <span class="keyword">sizeof</span>(*avc));</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno">  205</span>    <span class="keywordflow">if</span> (!avc)</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno">  206</span>        <a class="code hl_function" href="../../d7/dcc/fftools__cmdutils_8c.html#a00fcf983c7dd20dd65568b3ebc20ed44">exit_program</a>(1);</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno">  207</span>    <span class="keywordflow">for</span> (i = 0, j = 0; i &lt; <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a3d777831518f2c831790dd5cd6b96ddf">nb_output_files</a>; i++) {</div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno">  208</span>        <span class="keywordflow">if</span> (!strcmp(<a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a22c5e53407c3f14a8111e898dff42904">output_files</a>[i]-&gt;ctx-&gt;oformat-&gt;name, <span class="stringliteral">&quot;rtp&quot;</span>)) {</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno">  209</span>            avc[j] = <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a22c5e53407c3f14a8111e898dff42904">output_files</a>[i]-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>;</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno">  210</span>            j++;</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno">  211</span>        }</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno">  212</span>    }</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno">  213</span> </div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno">  214</span>    <span class="keywordflow">if</span> (!j) {</div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno">  215</span>        av_log(NULL, AV_LOG_ERROR, <span class="stringliteral">&quot;No output streams in the SDP.\n&quot;</span>);</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno">  216</span>        ret = AVERROR(EINVAL);</div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno">  217</span>        <span class="keywordflow">goto</span> fail;</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno">  218</span>    }</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno">  219</span> </div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno">  220</span>    ret = av_sdp_create(avc, j, sdp, <span class="keyword">sizeof</span>(sdp));</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno">  221</span>    <span class="keywordflow">if</span> (ret &lt; 0)</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno">  222</span>        <span class="keywordflow">goto</span> fail;</div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno">  223</span> </div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno">  224</span>    <span class="keywordflow">if</span> (!<a class="code hl_variable" href="../../d7/db3/fftools__ffmpeg_8h.html#a23afba338ad9fc8a6e65ba0f6400ebc3">sdp_filename</a>) {</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno">  225</span>        av_log(NULL, AV_LOG_ERROR, <span class="stringliteral">&quot;SDP:\n%s\n&quot;</span>, sdp);</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno">  226</span>        fflush(stdout);</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno">  227</span>    } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno">  228</span>        ret = avio_open2(&amp;sdp_pb, <a class="code hl_variable" href="../../d7/db3/fftools__ffmpeg_8h.html#a23afba338ad9fc8a6e65ba0f6400ebc3">sdp_filename</a>, AVIO_FLAG_WRITE, &amp;<a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a166da4a1a1f99ead2015de10ca32e48f">int_cb</a>, NULL);</div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno">  229</span>        <span class="keywordflow">if</span> (ret &lt; 0) {</div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno">  230</span>            av_log(NULL, AV_LOG_ERROR, <span class="stringliteral">&quot;Failed to open sdp file &#39;%s&#39;\n&quot;</span>, <a class="code hl_variable" href="../../d7/db3/fftools__ffmpeg_8h.html#a23afba338ad9fc8a6e65ba0f6400ebc3">sdp_filename</a>);</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno">  231</span>            <span class="keywordflow">goto</span> fail;</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno">  232</span>        }</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno">  233</span> </div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno">  234</span>        avio_print(sdp_pb, sdp);</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno">  235</span>        avio_closep(&amp;sdp_pb);</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno">  236</span>        av_freep(&amp;<a class="code hl_variable" href="../../d7/db3/fftools__ffmpeg_8h.html#a23afba338ad9fc8a6e65ba0f6400ebc3">sdp_filename</a>);</div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno">  237</span>    }</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno">  238</span> </div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno">  239</span>fail:</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno">  240</span>    av_freep(&amp;avc);</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno">  241</span>    <span class="keywordflow">return</span> ret;</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno">  242</span>}</div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno">  243</span> </div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno">  244</span><span class="comment">/* open the muxer when all the streams are initialized */</span></div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"><a class="line" href="../../d7/db3/fftools__ffmpeg_8h.html#a6397eeb0856f5070264449b7a24c438a">  245</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#a6397eeb0856f5070264449b7a24c438a">of_check_init</a>(<a class="code hl_struct" href="../../de/df2/struct_output_file.html">OutputFile</a> *of)</div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno">  246</span>{</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno">  247</span>    <span class="keywordtype">int</span> ret, i;</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno">  248</span> </div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno">  249</span>    <span class="keywordflow">for</span> (i = 0; i &lt; of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>-&gt;nb_streams; i++) {</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno">  250</span>        <a class="code hl_struct" href="../../db/dde/struct_output_stream.html">OutputStream</a> *ost = <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a205ff61315f3766dae7c5e1552de2ccf">output_streams</a>[of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#ac09855bfd066c44eb761f84e28f00dce">ost_index</a> + i];</div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno">  251</span>        <span class="keywordflow">if</span> (!ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a312a32277e0ba791fdfb36f71badb3f6">initialized</a>)</div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno">  252</span>            <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno">  253</span>    }</div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno">  254</span> </div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno">  255</span>    ret = avformat_write_header(of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>, &amp;of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#aac74ddf07f90ad30cd5ddf80583468ec">opts</a>);</div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno">  256</span>    <span class="keywordflow">if</span> (ret &lt; 0) {</div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno">  257</span>        av_log(NULL, AV_LOG_ERROR,</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno">  258</span>               <span class="stringliteral">&quot;Could not write header for output file #%d &quot;</span></div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno">  259</span>               <span class="stringliteral">&quot;(incorrect codec parameters ?): %s\n&quot;</span>,</div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno">  260</span>               of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a0ec33583a114c68a6c64b103fbd14b0d">index</a>, av_err2str(ret));</div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno">  261</span>        <span class="keywordflow">return</span> ret;</div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno">  262</span>    }</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno">  263</span>    <span class="comment">//assert_avoptions(of-&gt;opts);</span></div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno">  264</span>    of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a7f831b66ccff154c4e9d880d900e5b3f">header_written</a> = 1;</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno">  265</span> </div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno">  266</span>    av_dump_format(of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>, of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a0ec33583a114c68a6c64b103fbd14b0d">index</a>, of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>-&gt;url, 1);</div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno">  267</span>    <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a9b30165b9c938b5c27144f800ace6238">nb_output_dumped</a>++;</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno">  268</span> </div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno">  269</span>    <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d7/db3/fftools__ffmpeg_8h.html#a23afba338ad9fc8a6e65ba0f6400ebc3">sdp_filename</a> || <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#aee22300aab0a785e62da0d08de0c20d2">want_sdp</a>) {</div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno">  270</span>        ret = <a class="code hl_function" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#ae7e4c98861cf63306a9211c4b056f757">print_sdp</a>();</div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno">  271</span>        <span class="keywordflow">if</span> (ret &lt; 0) {</div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno">  272</span>            av_log(NULL, AV_LOG_ERROR, <span class="stringliteral">&quot;Error writing the SDP.\n&quot;</span>);</div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno">  273</span>            <span class="keywordflow">return</span> ret;</div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno">  274</span>        }</div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno">  275</span>    }</div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno">  276</span> </div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno">  277</span>    <span class="comment">/* flush the muxing queues */</span></div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno">  278</span>    <span class="keywordflow">for</span> (i = 0; i &lt; of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>-&gt;nb_streams; i++) {</div>
<div class="line"><a id="l00279" name="l00279"></a><span class="lineno">  279</span>        <a class="code hl_struct" href="../../db/dde/struct_output_stream.html">OutputStream</a> *ost = <a class="code hl_variable" href="../../d7/d48/fftools__ffmpeg_8c.html#a205ff61315f3766dae7c5e1552de2ccf">output_streams</a>[of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#ac09855bfd066c44eb761f84e28f00dce">ost_index</a> + i];</div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno">  280</span>        AVPacket *pkt;</div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno">  281</span> </div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno">  282</span>        <span class="comment">/* try to improve muxing time_base (only possible if nothing has been written yet) */</span></div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno">  283</span>        <span class="keywordflow">if</span> (!av_fifo_can_read(ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ae200b98ec6443b72e48ee97265921bbc">muxing_queue</a>))</div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno">  284</span>            ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#a253593d67e5088cf53c89aeb7e82cdc7">mux_timebase</a> = ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">st</a>-&gt;time_base;</div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno">  285</span> </div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno">  286</span>        <span class="keywordflow">while</span> (av_fifo_read(ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#ae200b98ec6443b72e48ee97265921bbc">muxing_queue</a>, &amp;pkt, 1) &gt;= 0) {</div>
<div class="line"><a id="l00287" name="l00287"></a><span class="lineno">  287</span>            ost-&gt;<a class="code hl_variable" href="../../db/dde/struct_output_stream.html#af18a803d7d7db08a1cdac6b54fc1a58f">muxing_queue_data_size</a> -= pkt-&gt;size;</div>
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno">  288</span>            <a class="code hl_function" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#aea0554f44067721a9066e82c8f5fc847">of_write_packet</a>(of, pkt, ost, 1);</div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno">  289</span>            av_packet_free(&amp;pkt);</div>
<div class="line"><a id="l00290" name="l00290"></a><span class="lineno">  290</span>        }</div>
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno">  291</span>    }</div>
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno">  292</span> </div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno">  293</span>    <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno">  294</span>}</div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno">  295</span> </div>
<div class="line"><a id="l00296" name="l00296"></a><span class="lineno"><a class="line" href="../../d7/db3/fftools__ffmpeg_8h.html#a8ee6bbffc4d71793d225e162b4e05600">  296</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#a8ee6bbffc4d71793d225e162b4e05600">of_write_trailer</a>(<a class="code hl_struct" href="../../de/df2/struct_output_file.html">OutputFile</a> *of)</div>
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno">  297</span>{</div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno">  298</span>    <span class="keywordtype">int</span> ret;</div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno">  299</span> </div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno">  300</span>    <span class="keywordflow">if</span> (!of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a7f831b66ccff154c4e9d880d900e5b3f">header_written</a>) {</div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno">  301</span>        av_log(NULL, AV_LOG_ERROR,</div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno">  302</span>               <span class="stringliteral">&quot;Nothing was written into output file %d (%s), because &quot;</span></div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno">  303</span>               <span class="stringliteral">&quot;at least one of its streams received no packets.\n&quot;</span>,</div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno">  304</span>               of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a0ec33583a114c68a6c64b103fbd14b0d">index</a>, of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>-&gt;url);</div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno">  305</span>        <span class="keywordflow">return</span> AVERROR(EINVAL);</div>
<div class="line"><a id="l00306" name="l00306"></a><span class="lineno">  306</span>    }</div>
<div class="line"><a id="l00307" name="l00307"></a><span class="lineno">  307</span> </div>
<div class="line"><a id="l00308" name="l00308"></a><span class="lineno">  308</span>    ret = av_write_trailer(of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>);</div>
<div class="line"><a id="l00309" name="l00309"></a><span class="lineno">  309</span>    <span class="keywordflow">if</span> (ret &lt; 0) {</div>
<div class="line"><a id="l00310" name="l00310"></a><span class="lineno">  310</span>        av_log(NULL, AV_LOG_ERROR, <span class="stringliteral">&quot;Error writing trailer of %s: %s\n&quot;</span>, of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>-&gt;url, av_err2str(ret));</div>
<div class="line"><a id="l00311" name="l00311"></a><span class="lineno">  311</span>        <span class="keywordflow">return</span> ret;</div>
<div class="line"><a id="l00312" name="l00312"></a><span class="lineno">  312</span>    }</div>
<div class="line"><a id="l00313" name="l00313"></a><span class="lineno">  313</span> </div>
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno">  314</span>    <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00315" name="l00315"></a><span class="lineno">  315</span>}</div>
<div class="line"><a id="l00316" name="l00316"></a><span class="lineno">  316</span> </div>
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno"><a class="line" href="../../d7/db3/fftools__ffmpeg_8h.html#a148f8b518ba854ce09c277c7acdc2cb7">  317</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/d94/fftools__ffmpeg__mux_8c.html#a148f8b518ba854ce09c277c7acdc2cb7">of_close</a>(<a class="code hl_struct" href="../../de/df2/struct_output_file.html">OutputFile</a> **pof)</div>
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno">  318</span>{</div>
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno">  319</span>    <a class="code hl_struct" href="../../de/df2/struct_output_file.html">OutputFile</a> *of = *pof;</div>
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno">  320</span>    AVFormatContext *s;</div>
<div class="line"><a id="l00321" name="l00321"></a><span class="lineno">  321</span> </div>
<div class="line"><a id="l00322" name="l00322"></a><span class="lineno">  322</span>    <span class="keywordflow">if</span> (!of)</div>
<div class="line"><a id="l00323" name="l00323"></a><span class="lineno">  323</span>        <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00324" name="l00324"></a><span class="lineno">  324</span> </div>
<div class="line"><a id="l00325" name="l00325"></a><span class="lineno">  325</span>    s = of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">ctx</a>;</div>
<div class="line"><a id="l00326" name="l00326"></a><span class="lineno">  326</span>    <span class="keywordflow">if</span> (s &amp;&amp; s-&gt;oformat &amp;&amp; !(s-&gt;oformat-&gt;flags &amp; AVFMT_NOFILE))</div>
<div class="line"><a id="l00327" name="l00327"></a><span class="lineno">  327</span>        avio_closep(&amp;s-&gt;pb);</div>
<div class="line"><a id="l00328" name="l00328"></a><span class="lineno">  328</span>    avformat_free_context(s);</div>
<div class="line"><a id="l00329" name="l00329"></a><span class="lineno">  329</span>    av_dict_free(&amp;of-&gt;<a class="code hl_variable" href="../../de/df2/struct_output_file.html#aac74ddf07f90ad30cd5ddf80583468ec">opts</a>);</div>
<div class="line"><a id="l00330" name="l00330"></a><span class="lineno">  330</span> </div>
<div class="line"><a id="l00331" name="l00331"></a><span class="lineno">  331</span>    av_freep(pof);</div>
<div class="line"><a id="l00332" name="l00332"></a><span class="lineno">  332</span>}</div>
<div class="ttc" id="afftools__cmdutils_8c_html_a00fcf983c7dd20dd65568b3ebc20ed44"><div class="ttname"><a href="../../d7/dcc/fftools__cmdutils_8c.html#a00fcf983c7dd20dd65568b3ebc20ed44">exit_program</a></div><div class="ttdeci">void exit_program(int ret)</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/dcc/fftools__cmdutils_8c_source.html#l00132">fftools_cmdutils.c:132</a></div></div>
<div class="ttc" id="afftools__cmdutils_8c_html_a2911387e778b01a25f0e65eabadf1b7b"><div class="ttname"><a href="../../d7/dcc/fftools__cmdutils_8c.html#a2911387e778b01a25f0e65eabadf1b7b">print_error</a></div><div class="ttdeci">void print_error(const char *filename, int err)</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/dcc/fftools__cmdutils_8c_source.html#l00844">fftools_cmdutils.c:844</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8c_html_a166da4a1a1f99ead2015de10ca32e48f"><div class="ttname"><a href="../../d7/d48/fftools__ffmpeg_8c.html#a166da4a1a1f99ead2015de10ca32e48f">int_cb</a></div><div class="ttdeci">__thread const AVIOInterruptCB int_cb</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d48/fftools__ffmpeg_8c_source.html#l00646">fftools_ffmpeg.c:646</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8c_html_a205ff61315f3766dae7c5e1552de2ccf"><div class="ttname"><a href="../../d7/d48/fftools__ffmpeg_8c.html#a205ff61315f3766dae7c5e1552de2ccf">output_streams</a></div><div class="ttdeci">__thread OutputStream ** output_streams</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d48/fftools__ffmpeg_8c_source.html#l00204">fftools_ffmpeg.c:204</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8c_html_a22c5e53407c3f14a8111e898dff42904"><div class="ttname"><a href="../../d7/d48/fftools__ffmpeg_8c.html#a22c5e53407c3f14a8111e898dff42904">output_files</a></div><div class="ttdeci">__thread OutputFile ** output_files</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d48/fftools__ffmpeg_8c_source.html#l00206">fftools_ffmpeg.c:206</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8c_html_a2bd3657586bb29d6357ddc0ed3bda70b"><div class="ttname"><a href="../../d7/d48/fftools__ffmpeg_8c.html#a2bd3657586bb29d6357ddc0ed3bda70b">nb_output_streams</a></div><div class="ttdeci">__thread int nb_output_streams</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d48/fftools__ffmpeg_8c_source.html#l00205">fftools_ffmpeg.c:205</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8c_html_a3d777831518f2c831790dd5cd6b96ddf"><div class="ttname"><a href="../../d7/d48/fftools__ffmpeg_8c.html#a3d777831518f2c831790dd5cd6b96ddf">nb_output_files</a></div><div class="ttdeci">__thread int nb_output_files</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d48/fftools__ffmpeg_8c_source.html#l00207">fftools_ffmpeg.c:207</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8c_html_a9b30165b9c938b5c27144f800ace6238"><div class="ttname"><a href="../../d7/d48/fftools__ffmpeg_8c.html#a9b30165b9c938b5c27144f800ace6238">nb_output_dumped</a></div><div class="ttdeci">__thread unsigned nb_output_dumped</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d48/fftools__ffmpeg_8c_source.html#l00190">fftools_ffmpeg.c:190</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8c_html_a9dfb20bc0a5b38e1f8a12d051c32c17f"><div class="ttname"><a href="../../d7/d48/fftools__ffmpeg_8c.html#a9dfb20bc0a5b38e1f8a12d051c32c17f">main_ffmpeg_return_code</a></div><div class="ttdeci">__thread int main_ffmpeg_return_code</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d48/fftools__ffmpeg_8c_source.html#l00469">fftools_ffmpeg.c:469</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8c_html_aee22300aab0a785e62da0d08de0c20d2"><div class="ttname"><a href="../../d7/d48/fftools__ffmpeg_8c.html#aee22300aab0a785e62da0d08de0c20d2">want_sdp</a></div><div class="ttdeci">__thread int want_sdp</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d48/fftools__ffmpeg_8c_source.html#l00192">fftools_ffmpeg.c:192</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8h_html"><div class="ttname"><a href="../../d7/db3/fftools__ffmpeg_8h.html">fftools_ffmpeg.h</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8h_html_a23afba338ad9fc8a6e65ba0f6400ebc3"><div class="ttname"><a href="../../d7/db3/fftools__ffmpeg_8h.html#a23afba338ad9fc8a6e65ba0f6400ebc3">sdp_filename</a></div><div class="ttdeci">__thread char * sdp_filename</div><div class="ttdef"><b>Definition:</b> <a href="../../da/d66/fftools__ffmpeg__opt_8c_source.html#l00184">fftools_ffmpeg_opt.c:184</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8h_html_a54e97364f74d8bf15062a8ea185f1c31"><div class="ttname"><a href="../../d7/db3/fftools__ffmpeg_8h.html#a54e97364f74d8bf15062a8ea185f1c31">OSTFinished</a></div><div class="ttdeci">OSTFinished</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00490">fftools_ffmpeg.h:490</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8h_html_a54e97364f74d8bf15062a8ea185f1c31acd6c6d4f0864009dfe2fb65c496f39a7"><div class="ttname"><a href="../../d7/db3/fftools__ffmpeg_8h.html#a54e97364f74d8bf15062a8ea185f1c31acd6c6d4f0864009dfe2fb65c496f39a7">ENCODER_FINISHED</a></div><div class="ttdeci">@ ENCODER_FINISHED</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00491">fftools_ffmpeg.h:491</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8h_html_a54e97364f74d8bf15062a8ea185f1c31ae8b7f720076ace3e8c20648c8b77835b"><div class="ttname"><a href="../../d7/db3/fftools__ffmpeg_8h.html#a54e97364f74d8bf15062a8ea185f1c31ae8b7f720076ace3e8c20648c8b77835b">MUXER_FINISHED</a></div><div class="ttdeci">@ MUXER_FINISHED</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00492">fftools_ffmpeg.h:492</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8h_html_a7ebbd72251d3d58fe5b316928a40bed3"><div class="ttname"><a href="../../d7/db3/fftools__ffmpeg_8h.html#a7ebbd72251d3d58fe5b316928a40bed3">audio_sync_method</a></div><div class="ttdeci">__thread int audio_sync_method</div><div class="ttdef"><b>Definition:</b> <a href="../../da/d66/fftools__ffmpeg__opt_8c_source.html#l00191">fftools_ffmpeg_opt.c:191</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8h_html_aa30902db873df385e004b04e2ecf7f6f"><div class="ttname"><a href="../../d7/db3/fftools__ffmpeg_8h.html#aa30902db873df385e004b04e2ecf7f6f">exit_on_error</a></div><div class="ttdeci">__thread int exit_on_error</div><div class="ttdef"><b>Definition:</b> <a href="../../da/d66/fftools__ffmpeg__opt_8c_source.html#l00202">fftools_ffmpeg_opt.c:202</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8h_html_aadd6ba914d1b3ecdf3b1322294beed34acf6f7467f9f3db143f3038b7ee906829"><div class="ttname"><a href="../../d7/db3/fftools__ffmpeg_8h.html#aadd6ba914d1b3ecdf3b1322294beed34acf6f7467f9f3db143f3038b7ee906829">VSYNC_DROP</a></div><div class="ttdeci">@ VSYNC_DROP</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00094">fftools_ffmpeg.h:94</a></div></div>
<div class="ttc" id="afftools__ffmpeg_8h_html_ae684cc527fec35feafac738f59a5fb34"><div class="ttname"><a href="../../d7/db3/fftools__ffmpeg_8h.html#ae684cc527fec35feafac738f59a5fb34">debug_ts</a></div><div class="ttdeci">__thread int debug_ts</div><div class="ttdef"><b>Definition:</b> <a href="../../da/d66/fftools__ffmpeg__opt_8c_source.html#l00201">fftools_ffmpeg_opt.c:201</a></div></div>
<div class="ttc" id="afftools__ffmpeg__mux_8c_html_a148f8b518ba854ce09c277c7acdc2cb7"><div class="ttname"><a href="../../d5/d94/fftools__ffmpeg__mux_8c.html#a148f8b518ba854ce09c277c7acdc2cb7">of_close</a></div><div class="ttdeci">void of_close(OutputFile **pof)</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d94/fftools__ffmpeg__mux_8c_source.html#l00317">fftools_ffmpeg_mux.c:317</a></div></div>
<div class="ttc" id="afftools__ffmpeg__mux_8c_html_a6397eeb0856f5070264449b7a24c438a"><div class="ttname"><a href="../../d5/d94/fftools__ffmpeg__mux_8c.html#a6397eeb0856f5070264449b7a24c438a">of_check_init</a></div><div class="ttdeci">int of_check_init(OutputFile *of)</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d94/fftools__ffmpeg__mux_8c_source.html#l00245">fftools_ffmpeg_mux.c:245</a></div></div>
<div class="ttc" id="afftools__ffmpeg__mux_8c_html_a8ee6bbffc4d71793d225e162b4e05600"><div class="ttname"><a href="../../d5/d94/fftools__ffmpeg__mux_8c.html#a8ee6bbffc4d71793d225e162b4e05600">of_write_trailer</a></div><div class="ttdeci">int of_write_trailer(OutputFile *of)</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d94/fftools__ffmpeg__mux_8c_source.html#l00296">fftools_ffmpeg_mux.c:296</a></div></div>
<div class="ttc" id="afftools__ffmpeg__mux_8c_html_ac237321f98a7041c9f6004d2ce8a425c"><div class="ttname"><a href="../../d5/d94/fftools__ffmpeg__mux_8c.html#ac237321f98a7041c9f6004d2ce8a425c">close_all_output_streams</a></div><div class="ttdeci">static void close_all_output_streams(OutputStream *ost, OSTFinished this_stream, OSTFinished others)</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d94/fftools__ffmpeg__mux_8c_source.html#l00050">fftools_ffmpeg_mux.c:50</a></div></div>
<div class="ttc" id="afftools__ffmpeg__mux_8c_html_ae7e4c98861cf63306a9211c4b056f757"><div class="ttname"><a href="../../d5/d94/fftools__ffmpeg__mux_8c.html#ae7e4c98861cf63306a9211c4b056f757">print_sdp</a></div><div class="ttdeci">static int print_sdp(void)</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d94/fftools__ffmpeg__mux_8c_source.html#l00191">fftools_ffmpeg_mux.c:191</a></div></div>
<div class="ttc" id="afftools__ffmpeg__mux_8c_html_aea0554f44067721a9066e82c8f5fc847"><div class="ttname"><a href="../../d5/d94/fftools__ffmpeg__mux_8c.html#aea0554f44067721a9066e82c8f5fc847">of_write_packet</a></div><div class="ttdeci">void of_write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d94/fftools__ffmpeg__mux_8c_source.html#l00059">fftools_ffmpeg_mux.c:59</a></div></div>
<div class="ttc" id="astruct_output_file_html"><div class="ttname"><a href="../../de/df2/struct_output_file.html">OutputFile</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00624">fftools_ffmpeg.h:624</a></div></div>
<div class="ttc" id="astruct_output_file_html_a0ec33583a114c68a6c64b103fbd14b0d"><div class="ttname"><a href="../../de/df2/struct_output_file.html#a0ec33583a114c68a6c64b103fbd14b0d">OutputFile::index</a></div><div class="ttdeci">int index</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00625">fftools_ffmpeg.h:625</a></div></div>
<div class="ttc" id="astruct_output_file_html_a6bfbcb8e4d6564ae0c488d58c0fb0d5f"><div class="ttname"><a href="../../de/df2/struct_output_file.html#a6bfbcb8e4d6564ae0c488d58c0fb0d5f">OutputFile::ctx</a></div><div class="ttdeci">AVFormatContext * ctx</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00629">fftools_ffmpeg.h:629</a></div></div>
<div class="ttc" id="astruct_output_file_html_a7f831b66ccff154c4e9d880d900e5b3f"><div class="ttname"><a href="../../de/df2/struct_output_file.html#a7f831b66ccff154c4e9d880d900e5b3f">OutputFile::header_written</a></div><div class="ttdeci">int header_written</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00638">fftools_ffmpeg.h:638</a></div></div>
<div class="ttc" id="astruct_output_file_html_aac74ddf07f90ad30cd5ddf80583468ec"><div class="ttname"><a href="../../de/df2/struct_output_file.html#aac74ddf07f90ad30cd5ddf80583468ec">OutputFile::opts</a></div><div class="ttdeci">AVDictionary * opts</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00630">fftools_ffmpeg.h:630</a></div></div>
<div class="ttc" id="astruct_output_file_html_ac09855bfd066c44eb761f84e28f00dce"><div class="ttname"><a href="../../de/df2/struct_output_file.html#ac09855bfd066c44eb761f84e28f00dce">OutputFile::ost_index</a></div><div class="ttdeci">int ost_index</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00631">fftools_ffmpeg.h:631</a></div></div>
<div class="ttc" id="astruct_output_stream_html"><div class="ttname"><a href="../../db/dde/struct_output_stream.html">OutputStream</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00495">fftools_ffmpeg.h:495</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a006aed9d49962d931da10f19a135f2bb"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a006aed9d49962d931da10f19a135f2bb">OutputStream::max_muxing_queue_size</a></div><div class="ttdeci">int max_muxing_queue_size</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00603">fftools_ffmpeg.h:603</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a1fd50164583dbdc664706be005120c1d"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a1fd50164583dbdc664706be005120c1d">OutputStream::last_mux_dts</a></div><div class="ttdeci">int64_t last_mux_dts</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00510">fftools_ffmpeg.h:510</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a253593d67e5088cf53c89aeb7e82cdc7"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a253593d67e5088cf53c89aeb7e82cdc7">OutputStream::mux_timebase</a></div><div class="ttdeci">AVRational mux_timebase</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00512">fftools_ffmpeg.h:512</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a2cb215b02eb510c4b19947063a5d5bd8"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a2cb215b02eb510c4b19947063a5d5bd8">OutputStream::finished</a></div><div class="ttdeci">OSTFinished finished</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00570">fftools_ffmpeg.h:570</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a312a32277e0ba791fdfb36f71badb3f6"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a312a32277e0ba791fdfb36f71badb3f6">OutputStream::initialized</a></div><div class="ttdeci">int initialized</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00577">fftools_ffmpeg.h:577</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a5a6eb3819ace72b542142a7082ceced3"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a5a6eb3819ace72b542142a7082ceced3">OutputStream::packets_written</a></div><div class="ttdeci">uint64_t packets_written</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00593">fftools_ffmpeg.h:593</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a6cb813f6df7342f0f37825241a3cd51b"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a6cb813f6df7342f0f37825241a3cd51b">OutputStream::max_frames</a></div><div class="ttdeci">int64_t max_frames</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00520">fftools_ffmpeg.h:520</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a6e2ea45e90d7df93766f580a39469719"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a6e2ea45e90d7df93766f580a39469719">OutputStream::muxing_queue_data_threshold</a></div><div class="ttdeci">size_t muxing_queue_data_threshold</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00615">fftools_ffmpeg.h:615</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a7efb75b87428b8442a2efd06734c9fb1"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a7efb75b87428b8442a2efd06734c9fb1">OutputStream::vsync_method</a></div><div class="ttdeci">enum VideoSyncMethod vsync_method</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00532">fftools_ffmpeg.h:532</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a989065f82c418b8c06bef4b4689ae1d8"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a989065f82c418b8c06bef4b4689ae1d8">OutputStream::frame_number</a></div><div class="ttdeci">int64_t frame_number</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00501">fftools_ffmpeg.h:501</a></div></div>
<div class="ttc" id="astruct_output_stream_html_a9cd48cbdf903d5bfee1b9c774e5cd46e"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#a9cd48cbdf903d5bfee1b9c774e5cd46e">OutputStream::is_cfr</a></div><div class="ttdeci">int is_cfr</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00533">fftools_ffmpeg.h:533</a></div></div>
<div class="ttc" id="astruct_output_stream_html_ab13acc03a389653d882f221141f12ae3"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#ab13acc03a389653d882f221141f12ae3">OutputStream::frame_rate</a></div><div class="ttdeci">AVRational frame_rate</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00530">fftools_ffmpeg.h:530</a></div></div>
<div class="ttc" id="astruct_output_stream_html_ab7b674f9a0c60e3e02526d560a83f583"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#ab7b674f9a0c60e3e02526d560a83f583">OutputStream::enc_ctx</a></div><div class="ttdeci">AVCodecContext * enc_ctx</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00517">fftools_ffmpeg.h:517</a></div></div>
<div class="ttc" id="astruct_output_stream_html_abd0357b7272cdb232e2db73eb458329e"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#abd0357b7272cdb232e2db73eb458329e">OutputStream::encoding_needed</a></div><div class="ttdeci">int encoding_needed</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00500">fftools_ffmpeg.h:500</a></div></div>
<div class="ttc" id="astruct_output_stream_html_ac0eae8884c54583e58eaa1999b342179"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#ac0eae8884c54583e58eaa1999b342179">OutputStream::data_size</a></div><div class="ttdeci">uint64_t data_size</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00591">fftools_ffmpeg.h:591</a></div></div>
<div class="ttc" id="astruct_output_stream_html_ac11510a2eeed3e6a14f0fbc85db2e088"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#ac11510a2eeed3e6a14f0fbc85db2e088">OutputStream::st</a></div><div class="ttdeci">AVStream * st</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00499">fftools_ffmpeg.h:499</a></div></div>
<div class="ttc" id="astruct_output_stream_html_ae200b98ec6443b72e48ee97265921bbc"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#ae200b98ec6443b72e48ee97265921bbc">OutputStream::muxing_queue</a></div><div class="ttdeci">AVFifo * muxing_queue</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00606">fftools_ffmpeg.h:606</a></div></div>
<div class="ttc" id="astruct_output_stream_html_ae22fe6ee1999d45be0d8722d04294a22"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#ae22fe6ee1999d45be0d8722d04294a22">OutputStream::index</a></div><div class="ttdeci">int index</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00497">fftools_ffmpeg.h:497</a></div></div>
<div class="ttc" id="astruct_output_stream_html_af18a803d7d7db08a1cdac6b54fc1a58f"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#af18a803d7d7db08a1cdac6b54fc1a58f">OutputStream::muxing_queue_data_size</a></div><div class="ttdeci">size_t muxing_queue_data_size</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00612">fftools_ffmpeg.h:612</a></div></div>
<div class="ttc" id="astruct_output_stream_html_af608105788daa4300771669d992ef890"><div class="ttname"><a href="../../db/dde/struct_output_stream.html#af608105788daa4300771669d992ef890">OutputStream::file_index</a></div><div class="ttdeci">int file_index</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/db3/fftools__ffmpeg_8h_source.html#l00496">fftools_ffmpeg.h:496</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat Sep 17 2022 18:38:13 for FFmpegKit iOS / macOS / tvOS API by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
